import { AppInfo } from "../../apps/appInfo";
import { startProcess } from "../../proceduce";
import { appStore } from "../../store";
import { ITemplate } from "../contextMenu/interfaces";

interface IDesktopContextMenuItemsEvents {
  onShowDesktopIconsClick(): void
}

export function getDesktopContextMenuItems(events: IDesktopContextMenuItemsEvents): ITemplate[] {
  const { showDesktopIcons } = appStore.getState('showDesktopIcons')

  return [
    {
      text: '查看', children: [
        { text: '大图标', value: 'large-icons' },
        { text: '中图标', value: 'medium-icons', checked: true },
        { text: '小图标', value: 'small-icons' },
        { divider: true },
        { text: '自动排列图标' },
        { text: '图标与网格对齐', checked: true },
        { divider: true },
        {
          text: '显示桌面', checked: showDesktopIcons, onClick: events.onShowDesktopIconsClick
        },
      ]
    },
    {
      text: '排序方式', children: [
        { text: '名称' },
        { text: '大小' },
        { text: '类型' },
        { text: '修改日期' }
      ]
    },
    { text: '刷新' },
    { divider: true },
    { text: '粘贴', disabled: true },
    { text: '粘贴快捷方式', disabled: true },
    { divider: true },
    {
      text: '新建', children: [
        { text: '文件夹', icon: 'imgs/icons/Folder.png', iconType: 'image' },
        { text: '快捷方式', iconType: 'image', icon: 'imgs/icons/Emblems/1010.png' },
        { divider: true },
        { text: '位图图像' },
        { text: '富文本文档' },
        { text: '文本文档', icon: 'imgs/icons/Notes.png', iconType: 'image' },
      ],
      emphasis: true
    },
    { divider: true },
    {
      icon: 'imgs/icons/Desktop.png',
      iconType: 'image',
      text: '显示设置', onClick: () => {
        startProcess({
          ...AppInfo.settings, type: 'app', args: 'system/display'
        })
      }
    },
    {
      icon: 'imgs/icons/Personalization.png',
      iconType: 'image',
      text: '个性化', onClick: () => {
        startProcess({
          ...AppInfo.settings, type: 'app', args: 'personalization'
        })
      }
    }
  ]
}
